{% extends "main.html" %}

{% block tabs %}
  {{ super() }}

  <style>
    /* Prevent horizontal overflow */
    body {
      overflow-x: hidden;
    }

    /* Hide main content for home page */
    .md-content {
      display: none;
    }

    /* Hide table of contents */
    @media screen and (min-width: 60em) {
      .md-sidebar--secondary {
        display: none;
      }
    }

    /* Hide navigation */
    @media screen and (min-width: 76.25em) {
      .md-sidebar--primary {
        display: none;
      }
    }

    /* Make header static */
    .md-header {
      position: initial;
    }

    .md-main__inner {
      margin: 0;
    }

    /* Style Learn More and View Integrations links */
    .lance-feature-section .md-button,
    .lance-intro-section .md-button:not(.md-button--primary) {
      background-color: transparent;
      color: #625EFF;
      text-decoration: underline;
      border: none;
      box-shadow: none;
    }

    .lance-feature-section .md-button:hover,
    .lance-intro-section .md-button:not(.md-button--primary):hover {
      background-color: transparent;
      color: #757575;
      text-decoration: underline;
    }
  </style>

  <script>
    // Fix palette toggle jumping to bottom of page
    (function() {
      // Store scroll position
      let savedScrollY = 0;
      let isTogglingPalette = false;

      // Prevent hash-based scrolling for palette changes
      if ('scrollRestoration' in history) {
        history.scrollRestoration = 'manual';
      }

      // Intercept scroll attempts during palette toggle
      const preventScroll = function() {
        if (isTogglingPalette) {
          window.scrollTo(0, savedScrollY);
        }
      };

      // Save scroll position and intercept clicks on palette toggle
      document.addEventListener('click', function(e) {
        const paletteLabel = e.target.closest('[for^="__palette"]');
        if (paletteLabel) {
          savedScrollY = window.scrollY;
          isTogglingPalette = true;

          // Prevent any scrolling for a brief moment
          window.addEventListener('scroll', preventScroll, { passive: false });

          setTimeout(function() {
            isTogglingPalette = false;
            window.removeEventListener('scroll', preventScroll);
          }, 100);
        }
      }, true);

      // Listen for hash changes from palette toggle
      window.addEventListener('hashchange', function(e) {
        if (window.location.hash.startsWith('#__palette')) {
          e.preventDefault();
          // Immediately restore scroll position
          window.scrollTo(0, savedScrollY);
          // Clean up hash without triggering another hashchange
          history.replaceState(null, null, window.location.pathname);
        }
      }, false);

      // Also handle palette input changes directly
      document.addEventListener('DOMContentLoaded', function() {
        const paletteInputs = document.querySelectorAll('input[name="__palette"]');
        paletteInputs.forEach(function(input) {
          input.addEventListener('change', function() {
            window.scrollTo(0, savedScrollY);
          });
        });
      });
    })();
  </script>

  <!-- Hero Section -->
  <section class="mdx-container">
    <div class="container">
      <div class="intro-message">
        <div class="hero-logo">
          <img src="logo/white.png" alt="Lance Logo">
          <h1>Lance<sup>™</sup></h1>
        </div>
        <h3>The Open Lakehouse Format for Multimodal AI</h3>
        <hr class="intro-divider" />
        <ul class="list-inline">
          <li>
            <a href="quickstart" class="md-button md-button--primary">Get Started</a>
          </li>
          <li>
            <a href="format" class="md-button">Read the Spec</a>
          </li>
          <li>
            <a href="examples/python/llm_training" class="md-button">Train an LLM</a>
          </li>
          <li>
            <a href="https://discord.gg/lance" class="md-button" target="_blank" rel="noopener">Join Discord</a>
          </li>
        </ul>
      </div>
    </div>
  </section>

  <!-- What is Lance Section -->
  <section class="lance-intro-section">
    <div class="container">
      <div class="lance-intro-content">
        <h2>What is Lance<sup>™</sup>?</h2>
        <p>
          Lance contains a file format, table format, and catalog spec for multimodal AI,
          allowing you to build a complete open lakehouse on top of object storage to power your AI workflows.
          Lance brings high-performance vector search, full-text search, random access, and feature
          engineering capabilities to the lakehouse, while you can still get all the existing lakehouse benefits
          like SQL analytics, ACID transactions, time travel, and integrations with open engines (Apache Spark, Ray, PyTorch, Trino, DuckDB, etc.)
          and open catalogs (Apache Polaris, Unity Catalog, Apache Gravitino, Hive Metastore, etc.)
        </p>
        <a href="quickstart" class="md-button md-button--primary">Learn More</a>
      </div>
    </div>
  </section>

  <!-- Feature 1: Expressive Hybrid Search -->
  <section class="lance-feature-section">
    <div class="container">
      <div class="lance-feature-content">
        <div class="lance-feature-text">
          <h2>Expressive Hybrid Search</h2>
          <p>
            Lance enables powerful hybrid search combining vector similarity, full-text search,
            and SQL analytics on the same dataset. All query types are accelerated by corresponding
            secondary indexes as part of the Lance specification.
          </p>
          <p>
            Run semantic search on embeddings, BM25 search on keywords, and apply complex SQL predicates -
            all using a single table with a unified interface.
          </p>
          <a href="quickstart/vector-search" class="md-button">Learn More</a>
        </div>
        <div class="lance-feature-demo">
          <img src="assets/images/hybrid-search.png" alt="Hybrid Search Example" style="max-width: 500px; width: 100%; height: auto; border-radius: 8px;">
        </div>
      </div>
    </div>
  </section>

  <!-- Feature 2: Lightning-fast Random Access -->
  <section class="lance-feature-section reverse">
    <div class="container">
      <div class="lance-feature-content">
        <div class="lance-feature-text">
          <h2>Lightning-fast Random Access</h2>
          <p>
            Lance delivers 100x faster random access compared to Parquet or Iceberg.
            Unlike traditional formats, Lance maintains high performance even when
            randomly accessing scattered rows across your entire dataset.
          </p>
          <p>
            With a highly optimized file format plus efficient row-addressing and secondary indexes at table level,
            you can access individual records across multiple files instantly,
            making it perfect for real-time ML serving, random sampling, and interactive applications.
          </p>
          <a href="guide/read_and_write#random-access" class="md-button">Learn More</a>
        </div>
        <div class="lance-feature-demo">
          <img src="assets/images/random-access.png" alt="Random Access Example" style="max-width: 500px; width: 100%; height: auto; border-radius: 8px;">
        </div>
      </div>
    </div>
  </section>

  <!-- Feature 3: Native Multimodal Data Support -->
  <section class="lance-feature-section">
    <div class="container">
      <div class="lance-feature-content">
        <div class="lance-feature-text">
          <h2>Native Multimodal Data Support</h2>
          <p>
            Store images, videos, audio, text, and embeddings alongside your traditional tabular data in a single unified format.
            Lance's blob encoding efficiently handles large binary objects with lazy loading,
            while optimized vector storage accelerates similarity search.
          </p>
          <p>
            Perfect for AI/ML workloads where you need to store raw data, ML features, generated captions and embeddings
            all together for multimodal retrieval and genAI workflows.
          </p>
          <a href="guide/blob" class="md-button">Learn More</a>
        </div>
        <div class="lance-feature-demo">
          <img src="assets/images/multimodal-data.png" alt="Multimodal Data Example" style="max-width: 500px; width: 100%; height: auto; border-radius: 8px;">
        </div>
      </div>
    </div>
  </section>

  <!-- Feature 4: Data Evolution -->
  <section class="lance-feature-section reverse">
    <div class="container">
      <div class="lance-feature-content">
        <div class="lance-feature-text">
          <h2>Data Evolution > Schema Evolution</h2>
          <p>
            Schema evolution in most open table formats are metadata only and fast.
            But when trying to backfill column values in existing rows, a full table rewrite is typically required.
            Lance supports data evolution (efficient schema evolution with backfill), making it perfect for ML
            feature engineering, embedding and media content management.
          </p>
          <p>
            Adding a new column with data is as simple as writing new Lance files to the Lance table -
            no need to rewrite your entire dataset.
          </p>
          <a href="guide/data_evolution" class="md-button">Learn More</a>
        </div>
        <div class="lance-feature-demo">
          <img src="assets/images/data-evolution.png" alt="Data Evolution Example" style="max-width: 500px; width: 100%; height: auto; border-radius: 8px;">
        </div>
      </div>
    </div>
  </section>

  <!-- Feature 5: Rich Ecosystem Integration -->
  <section class="lance-feature-section">
    <div class="container">
      <div class="lance-feature-content">
        <div class="lance-feature-text">
          <h2>Rich Ecosystem Integrations</h2>
          <p>
            As an open format, Lance integrates seamlessly with the Python data ecosystem and modern data platforms.
            Work with your favorite tools including Pandas, Polars, Ray and PyTorch for data processing and machine learning.
          </p>
          <p>
            Connect with leading query engines like Apache DataFusion, DuckDB, Apache Spark, Trino, and Apache Flink/Fluss
            to run SQL analytics and distributed processing on your Lance datasets.
          </p>
          <a href="integrations/datafusion" class="md-button">View Integrations</a>
        </div>
        <div class="lance-feature-demo">
          <img src="assets/images/ecosystem-integrations.png" alt="Lance Ecosystem Integrations" style="max-width: 500px; width: 100%; height: auto; border-radius: 8px;">
        </div>
      </div>
    </div>
  </section>


{% endblock %}

{% block content %}{% endblock %}
{% block footer %}
  {{ super() }}
{% endblock %}
